package TestDemo2;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Administrator
 * Date: 2024-03-13
 * Time: 16:44
 */
class Base3{
    public int a = 1;
    public int b = 2;
    public int d = 10;
    public void func(){
        System.out.println("父类方法：func()");
    }
    public  Base3(){
    }
    public Base3(int a){
        this.a = a;
    }
}

class Derived3 extends Base3{
    public int a = 50;
    public int b = 40;
    public int c = 30;
    public Derived3(int a){
        super(a);
    }
    public Derived3(){
        super();
    }
    public void func2(){
        System.out.println("父类方法：func2()");
    }

    public void func(int a){
        System.out.println("子类方法：func(int)");
    }

    public void func() {
        System.out.println("子类方法：func()");;
    }

    public void method(){
        System.out.println(super.a);
        System.out.println(super.b);
        System.out.println(this.a);
        System.out.println(this.b);
        System.out.println(this.c);
        System.out.println(this.d);
        System.out.println("====================");
        System.out.println(super.a);
        System.out.println(super.b);
        System.out.println(super.d);
        System.out.println("======================");
        func();
        func2();
        System.out.println("======================");
        func(10);
        super.func();
    }
}
public class Test3 {
    public static void main(String[] args) {
        Base3 base = new Base3();
        Base3 base2 = new Base3(10);
        Derived3 derived = new Derived3();
        Derived3 derived1 = new Derived3(20);
        derived.method();
    }
}